<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="common/include :: header('编辑员工')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-employee-edit" th:object="${employee}">
		<input type="hidden" name="id" th:field="*{id}">
		<div class="form-group">
			<label class="col-sm-3 control-label">员工姓名：</label>
			<div class="col-sm-8">
				<input name="name" class="form-control" type="text" th:field="*{name}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">员工邮箱：</label>
			<div class="col-sm-8">
				<input name="email" class="form-control" type="text" th:field="*{email}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">员工年龄：</label>
			<div class="col-sm-8">
				<input name="age" class="form-control" type="number" step="1" th:field="*{age}">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">员工性别：</label>
			<div class="col-sm-8">
				<select name="gender" class="form-control m-b" th:with="gender=${@dict.getType('sys_user_sex')}" th:field="*{gender}">
					<option th:each="dict : ${gender}" th:text="${dict.label}" th:value="${dict.value}"></option>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">是否管理：</label>
			<div class="col-sm-8">
				<select name="admin" class="form-control m-b" th:with="admin=${@dict.getType('employee_admin')}" th:field="*{admin}">
					<option th:each="dict : ${admin}" th:text="${dict.label}" th:value="${dict.value}"></option>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">入职时间：</label>
			<div class="col-sm-8">
				<div class="input-group date">
					<input name="hiredate" class="form-control" disabled placeholder="yyyy-MM-dd HH:mm" type="text" th:field="*{hiredate}">
					<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">所在部门：</label>
			<div class="col-sm-8">
				<select name="deptId" class="form-control m-b" th:field="*{deptId}">
					<option th:each="dept:${departments}" th:text="${dept.name}"
							th:value="${dept.id}"></option>
				</select>
			</div>
		</div>
	</form>
</div>
<th:block th:include="common/include :: footer" />
<th:block th:include="common/include :: datetimepicker" />
<script th:inline="javascript">
	var prefix = ctx + "/business/employee";
	$("#form-employee-edit").validate({
		focusCleanup: true
	});

	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/edit", $('#form-employee-edit').serialize());
		}
	}

	$("input[name='hiredate']").datetimepicker({
		format: "yyyy-mm-dd hh:ii",
		autoclose: true
	});
</script>
</body>
</html>